<template>
    <view class="page">
         <!-- <view class="tab flex font-size-16 bac-color-fff flex text-center">
            <navigator url="/pages/social/be_apply" open-type="redirect"  class="tab-item flex-1 active" >
                <text>我的申请</text>
            </navigator>
            <navigator url="/pages/social/myhelp"  open-type="redirect" class="tab-item flex-1" >
                <text>我的帮扶</text>
            </navigator>
            <navigator url="/pages/social/pub_apply_detail" class="tab-item flex-1">
                <text>爱心帮帮团</text>
            </navigator>
        </view> -->
        
        <view class="container  list" >
            <view class="list" >
                <block v-if="list.length">
                    <navigator :url="'/pages/social/home_apply_detail?id='+item.id" hover-class="none" open-type="navigate"  class="list-item bac-color-fff flex align-center mar-t-15" v-for="(item,index) in list" :key="index">
                    <view class="flex-1">
                        <view class="font-color-333 font-size-15 ">
                            <text >帮扶申请（{{item.child_usernme}}）</text>
                        </view>

                    </view>
                      <view>
                        <view>
                          <text class="font-color-999 font-size-15" >{{transformTime(item.create_time)}}</text>
                        </view>
                      </view>
<!--                    <view class="text-center">-->
<!--                        <view class="status-fail" v-if="item.audit_status == 0"><text >已驳回</text></view>-->
<!--                        <view class="status-yellow" v-if="item.audit_status == 1">待审核</view>-->
<!--                        <view class="status-danger " v-if="item.audit_status == 2 "><text>待帮扶</text></view>-->
<!--                        <view class="mar-t-3 yellow-btn btn" v-if="item.audit_status == 3" @click.stop="doComment(item.ltype,item.order_no)"><text >立即评价</text></view>-->
<!--                        <view class="status-success" v-if="item.audit_status == 4"><text >已完成</text></view>-->
<!--                    </view>-->

                </navigator>
                </block>
                <no-data v-else></no-data>
            </view>
        </view>

    </view>
</template>

<script>
import {beApply} from '@/utils/http'
export default {
    data() {
        return {
            index_page:0,
            total_page:1,
            list:[],
            type:'home_apply',
        }
    },
    methods: {
        init(){
            this.index_page = 0 ;
            this.total_page = 1;
            this.list = [];
        },
        beApply(){
            beApply({page: this.index_page + 1,type:this.type}).then(res=>{
                if (res) {
					this.index_page = res.current_page
					this.total_page = res.last_page
					this.list = [...this.list, ...res.data]
				}
            })
        },
        changeType(type){
            if(this.type !=type){
                this.type = type
                this.init();
                this.myApply();
            }
        },
        doComment(type,order_no){
            this.href('/pages/social/evaluate?type='+type+'&order_no='+order_no)
        }   
        
    },
    //下拉刷新
	onPullDownRefresh() {
		this.index_page = 0
		this.total_page = 1
		this.list = []
		// this.getCate()
		this.myApply()
	},
	//上拉加载
	onReachBottom() {
		if (this.index_page < this.total_page) {
			this.myApply()
		}
	},
    onShow(){
        this.beApply();
    }
}
</script>

<style scoped>
page{
    background-color: #F4F5FA !important;
}
.tab .active{
    color: #0088FF;
    font-weight: bold;
    /* width: 140rpx; */
}
.tab .tab-item{
    padding: 15px 15px;
}
.list-item{
    padding: 20px 15px;
}
.list-item .tag{
    padding: 2px 5px;
    background:linear-gradient(to right,#2F82FA ,#4AB9FC);
    border-radius:10px;
}
.btn{
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
}
</style>